using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;
using System.IO;

namespace Emlyn.Applications.Scratch.Graphics.Tools
{
    public class Textures: List<Texture>, IDisposable
    {
        DirectXWrapper _wrapper = null;

        public Textures(DirectXWrapper aWrapper)
        {
            _wrapper = aWrapper;
        }

        public void ClearTextures()
        {
            foreach (Texture ltexture in this)
            {
                ltexture.Dispose();
            }
            Clear();
        }

        public void AddTextures(string afilePath, string afileMask)
        {
            foreach (string lfileName in Directory.GetFiles(afilePath, afileMask))
            {
                Add(_wrapper.LoadTextureFromFile(lfileName));
            }
        }

        #region IDisposable Members

        public void Dispose()
        {
            Clear();
        }

        #endregion
    }
}
